// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Serverless.Core;
using Elastic.Clients.Elasticsearch.Serverless.Fluent;
using Elastic.Clients.Elasticsearch.Serverless.Serialization;
using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Serverless.Analysis;

public partial class TokenFilters : IsADictionary<string, ITokenFilter>
{
	public TokenFilters()
	{
	}

	public TokenFilters(IDictionary<string, ITokenFilter> container) : base(container)
	{
	}

	public void Add(string name, ITokenFilter tokenFilter) => BackingDictionary.Add(Sanitize(name), tokenFilter);
	public bool TryGetTokenFilter(string name, [NotNullWhen(returnValue: true)] out ITokenFilter tokenFilter) => BackingDictionary.TryGetValue(Sanitize(name), out tokenFilter);

	public bool TryGetTokenFilter<T>(string name, [NotNullWhen(returnValue: true)] out T? tokenFilter) where T : class, ITokenFilter
	{
		if (BackingDictionary.TryGetValue(Sanitize(name), out var matchedValue) && matchedValue is T finalValue)
		{
			tokenFilter = finalValue;
			return true;
		}

		tokenFilter = null;
		return false;
	}
}

public sealed partial class TokenFiltersDescriptor : IsADictionaryDescriptor<TokenFiltersDescriptor, TokenFilters, string, ITokenFilter>
{
	public TokenFiltersDescriptor() : base(new TokenFilters())
	{
	}

	public TokenFiltersDescriptor(TokenFilters tokenFilters) : base(tokenFilters ?? new TokenFilters())
	{
	}

	public TokenFiltersDescriptor AsciiFolding(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.AsciiFoldingTokenFilterDescriptor, AsciiFoldingTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor AsciiFolding(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.AsciiFoldingTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.AsciiFoldingTokenFilterDescriptor, AsciiFoldingTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor AsciiFolding(string tokenFilterName, AsciiFoldingTokenFilter asciiFoldingTokenFilter) => AssignVariant(tokenFilterName, asciiFoldingTokenFilter);
	public TokenFiltersDescriptor CommonGrams(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.CommonGramsTokenFilterDescriptor, CommonGramsTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor CommonGrams(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.CommonGramsTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.CommonGramsTokenFilterDescriptor, CommonGramsTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor CommonGrams(string tokenFilterName, CommonGramsTokenFilter commonGramsTokenFilter) => AssignVariant(tokenFilterName, commonGramsTokenFilter);
	public TokenFiltersDescriptor Condition(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.ConditionTokenFilterDescriptor, ConditionTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Condition(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.ConditionTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.ConditionTokenFilterDescriptor, ConditionTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Condition(string tokenFilterName, ConditionTokenFilter conditionTokenFilter) => AssignVariant(tokenFilterName, conditionTokenFilter);
	public TokenFiltersDescriptor DelimitedPayload(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.DelimitedPayloadTokenFilterDescriptor, DelimitedPayloadTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor DelimitedPayload(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.DelimitedPayloadTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.DelimitedPayloadTokenFilterDescriptor, DelimitedPayloadTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor DelimitedPayload(string tokenFilterName, DelimitedPayloadTokenFilter delimitedPayloadTokenFilter) => AssignVariant(tokenFilterName, delimitedPayloadTokenFilter);
	public TokenFiltersDescriptor DictionaryDecompounder(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.DictionaryDecompounderTokenFilterDescriptor, DictionaryDecompounderTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor DictionaryDecompounder(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.DictionaryDecompounderTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.DictionaryDecompounderTokenFilterDescriptor, DictionaryDecompounderTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor DictionaryDecompounder(string tokenFilterName, DictionaryDecompounderTokenFilter dictionaryDecompounderTokenFilter) => AssignVariant(tokenFilterName, dictionaryDecompounderTokenFilter);
	public TokenFiltersDescriptor EdgeNGram(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.EdgeNGramTokenFilterDescriptor, EdgeNGramTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor EdgeNGram(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.EdgeNGramTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.EdgeNGramTokenFilterDescriptor, EdgeNGramTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor EdgeNGram(string tokenFilterName, EdgeNGramTokenFilter edgeNGramTokenFilter) => AssignVariant(tokenFilterName, edgeNGramTokenFilter);
	public TokenFiltersDescriptor Elision(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.ElisionTokenFilterDescriptor, ElisionTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Elision(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.ElisionTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.ElisionTokenFilterDescriptor, ElisionTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Elision(string tokenFilterName, ElisionTokenFilter elisionTokenFilter) => AssignVariant(tokenFilterName, elisionTokenFilter);
	public TokenFiltersDescriptor Fingerprint(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.FingerprintTokenFilterDescriptor, FingerprintTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Fingerprint(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.FingerprintTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.FingerprintTokenFilterDescriptor, FingerprintTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Fingerprint(string tokenFilterName, FingerprintTokenFilter fingerprintTokenFilter) => AssignVariant(tokenFilterName, fingerprintTokenFilter);
	public TokenFiltersDescriptor Hunspell(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.HunspellTokenFilterDescriptor, HunspellTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Hunspell(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.HunspellTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.HunspellTokenFilterDescriptor, HunspellTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Hunspell(string tokenFilterName, HunspellTokenFilter hunspellTokenFilter) => AssignVariant(tokenFilterName, hunspellTokenFilter);
	public TokenFiltersDescriptor HyphenationDecompounder(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.HyphenationDecompounderTokenFilterDescriptor, HyphenationDecompounderTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor HyphenationDecompounder(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.HyphenationDecompounderTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.HyphenationDecompounderTokenFilterDescriptor, HyphenationDecompounderTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor HyphenationDecompounder(string tokenFilterName, HyphenationDecompounderTokenFilter hyphenationDecompounderTokenFilter) => AssignVariant(tokenFilterName, hyphenationDecompounderTokenFilter);
	public TokenFiltersDescriptor IcuCollation(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuCollationTokenFilterDescriptor, IcuCollationTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor IcuCollation(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuCollationTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuCollationTokenFilterDescriptor, IcuCollationTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor IcuCollation(string tokenFilterName, IcuCollationTokenFilter icuCollationTokenFilter) => AssignVariant(tokenFilterName, icuCollationTokenFilter);
	public TokenFiltersDescriptor IcuFolding(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuFoldingTokenFilterDescriptor, IcuFoldingTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor IcuFolding(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuFoldingTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuFoldingTokenFilterDescriptor, IcuFoldingTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor IcuFolding(string tokenFilterName, IcuFoldingTokenFilter icuFoldingTokenFilter) => AssignVariant(tokenFilterName, icuFoldingTokenFilter);
	public TokenFiltersDescriptor IcuNormalization(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuNormalizationTokenFilterDescriptor, IcuNormalizationTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor IcuNormalization(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuNormalizationTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuNormalizationTokenFilterDescriptor, IcuNormalizationTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor IcuNormalization(string tokenFilterName, IcuNormalizationTokenFilter icuNormalizationTokenFilter) => AssignVariant(tokenFilterName, icuNormalizationTokenFilter);
	public TokenFiltersDescriptor IcuTransform(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuTransformTokenFilterDescriptor, IcuTransformTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor IcuTransform(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuTransformTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuTransformTokenFilterDescriptor, IcuTransformTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor IcuTransform(string tokenFilterName, IcuTransformTokenFilter icuTransformTokenFilter) => AssignVariant(tokenFilterName, icuTransformTokenFilter);
	public TokenFiltersDescriptor KeepTypes(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeepTypesTokenFilterDescriptor, KeepTypesTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor KeepTypes(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeepTypesTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeepTypesTokenFilterDescriptor, KeepTypesTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor KeepTypes(string tokenFilterName, KeepTypesTokenFilter keepTypesTokenFilter) => AssignVariant(tokenFilterName, keepTypesTokenFilter);
	public TokenFiltersDescriptor KeepWords(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeepWordsTokenFilterDescriptor, KeepWordsTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor KeepWords(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeepWordsTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeepWordsTokenFilterDescriptor, KeepWordsTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor KeepWords(string tokenFilterName, KeepWordsTokenFilter keepWordsTokenFilter) => AssignVariant(tokenFilterName, keepWordsTokenFilter);
	public TokenFiltersDescriptor KeywordMarker(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeywordMarkerTokenFilterDescriptor, KeywordMarkerTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor KeywordMarker(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeywordMarkerTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeywordMarkerTokenFilterDescriptor, KeywordMarkerTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor KeywordMarker(string tokenFilterName, KeywordMarkerTokenFilter keywordMarkerTokenFilter) => AssignVariant(tokenFilterName, keywordMarkerTokenFilter);
	public TokenFiltersDescriptor KStem(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KStemTokenFilterDescriptor, KStemTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor KStem(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.KStemTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KStemTokenFilterDescriptor, KStemTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor KStem(string tokenFilterName, KStemTokenFilter kStemTokenFilter) => AssignVariant(tokenFilterName, kStemTokenFilter);
	public TokenFiltersDescriptor KuromojiPartOfSpeech(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor, KuromojiPartOfSpeechTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor KuromojiPartOfSpeech(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiPartOfSpeechTokenFilterDescriptor, KuromojiPartOfSpeechTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor KuromojiPartOfSpeech(string tokenFilterName, KuromojiPartOfSpeechTokenFilter kuromojiPartOfSpeechTokenFilter) => AssignVariant(tokenFilterName, kuromojiPartOfSpeechTokenFilter);
	public TokenFiltersDescriptor KuromojiReadingForm(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiReadingFormTokenFilterDescriptor, KuromojiReadingFormTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor KuromojiReadingForm(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiReadingFormTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiReadingFormTokenFilterDescriptor, KuromojiReadingFormTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor KuromojiReadingForm(string tokenFilterName, KuromojiReadingFormTokenFilter kuromojiReadingFormTokenFilter) => AssignVariant(tokenFilterName, kuromojiReadingFormTokenFilter);
	public TokenFiltersDescriptor KuromojiStemmer(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiStemmerTokenFilterDescriptor, KuromojiStemmerTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor KuromojiStemmer(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiStemmerTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiStemmerTokenFilterDescriptor, KuromojiStemmerTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor KuromojiStemmer(string tokenFilterName, KuromojiStemmerTokenFilter kuromojiStemmerTokenFilter) => AssignVariant(tokenFilterName, kuromojiStemmerTokenFilter);
	public TokenFiltersDescriptor Length(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.LengthTokenFilterDescriptor, LengthTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Length(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.LengthTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.LengthTokenFilterDescriptor, LengthTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Length(string tokenFilterName, LengthTokenFilter lengthTokenFilter) => AssignVariant(tokenFilterName, lengthTokenFilter);
	public TokenFiltersDescriptor LimitTokenCount(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.LimitTokenCountTokenFilterDescriptor, LimitTokenCountTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor LimitTokenCount(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.LimitTokenCountTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.LimitTokenCountTokenFilterDescriptor, LimitTokenCountTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor LimitTokenCount(string tokenFilterName, LimitTokenCountTokenFilter limitTokenCountTokenFilter) => AssignVariant(tokenFilterName, limitTokenCountTokenFilter);
	public TokenFiltersDescriptor Lowercase(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.LowercaseTokenFilterDescriptor, LowercaseTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Lowercase(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.LowercaseTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.LowercaseTokenFilterDescriptor, LowercaseTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Lowercase(string tokenFilterName, LowercaseTokenFilter lowercaseTokenFilter) => AssignVariant(tokenFilterName, lowercaseTokenFilter);
	public TokenFiltersDescriptor Multiplexer(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.MultiplexerTokenFilterDescriptor, MultiplexerTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Multiplexer(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.MultiplexerTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.MultiplexerTokenFilterDescriptor, MultiplexerTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Multiplexer(string tokenFilterName, MultiplexerTokenFilter multiplexerTokenFilter) => AssignVariant(tokenFilterName, multiplexerTokenFilter);
	public TokenFiltersDescriptor NGram(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.NGramTokenFilterDescriptor, NGramTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor NGram(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.NGramTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.NGramTokenFilterDescriptor, NGramTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor NGram(string tokenFilterName, NGramTokenFilter nGramTokenFilter) => AssignVariant(tokenFilterName, nGramTokenFilter);
	public TokenFiltersDescriptor NoriPartOfSpeech(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.NoriPartOfSpeechTokenFilterDescriptor, NoriPartOfSpeechTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor NoriPartOfSpeech(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.NoriPartOfSpeechTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.NoriPartOfSpeechTokenFilterDescriptor, NoriPartOfSpeechTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor NoriPartOfSpeech(string tokenFilterName, NoriPartOfSpeechTokenFilter noriPartOfSpeechTokenFilter) => AssignVariant(tokenFilterName, noriPartOfSpeechTokenFilter);
	public TokenFiltersDescriptor PatternCapture(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.PatternCaptureTokenFilterDescriptor, PatternCaptureTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor PatternCapture(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.PatternCaptureTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.PatternCaptureTokenFilterDescriptor, PatternCaptureTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor PatternCapture(string tokenFilterName, PatternCaptureTokenFilter patternCaptureTokenFilter) => AssignVariant(tokenFilterName, patternCaptureTokenFilter);
	public TokenFiltersDescriptor PatternReplace(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.PatternReplaceTokenFilterDescriptor, PatternReplaceTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor PatternReplace(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.PatternReplaceTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.PatternReplaceTokenFilterDescriptor, PatternReplaceTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor PatternReplace(string tokenFilterName, PatternReplaceTokenFilter patternReplaceTokenFilter) => AssignVariant(tokenFilterName, patternReplaceTokenFilter);
	public TokenFiltersDescriptor Phonetic(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.PhoneticTokenFilterDescriptor, PhoneticTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Phonetic(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.PhoneticTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.PhoneticTokenFilterDescriptor, PhoneticTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Phonetic(string tokenFilterName, PhoneticTokenFilter phoneticTokenFilter) => AssignVariant(tokenFilterName, phoneticTokenFilter);
	public TokenFiltersDescriptor PorterStem(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.PorterStemTokenFilterDescriptor, PorterStemTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor PorterStem(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.PorterStemTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.PorterStemTokenFilterDescriptor, PorterStemTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor PorterStem(string tokenFilterName, PorterStemTokenFilter porterStemTokenFilter) => AssignVariant(tokenFilterName, porterStemTokenFilter);
	public TokenFiltersDescriptor Predicate(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.PredicateTokenFilterDescriptor, PredicateTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Predicate(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.PredicateTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.PredicateTokenFilterDescriptor, PredicateTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Predicate(string tokenFilterName, PredicateTokenFilter predicateTokenFilter) => AssignVariant(tokenFilterName, predicateTokenFilter);
	public TokenFiltersDescriptor RemoveDuplicates(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.RemoveDuplicatesTokenFilterDescriptor, RemoveDuplicatesTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor RemoveDuplicates(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.RemoveDuplicatesTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.RemoveDuplicatesTokenFilterDescriptor, RemoveDuplicatesTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor RemoveDuplicates(string tokenFilterName, RemoveDuplicatesTokenFilter removeDuplicatesTokenFilter) => AssignVariant(tokenFilterName, removeDuplicatesTokenFilter);
	public TokenFiltersDescriptor Reverse(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.ReverseTokenFilterDescriptor, ReverseTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Reverse(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.ReverseTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.ReverseTokenFilterDescriptor, ReverseTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Reverse(string tokenFilterName, ReverseTokenFilter reverseTokenFilter) => AssignVariant(tokenFilterName, reverseTokenFilter);
	public TokenFiltersDescriptor Shingle(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.ShingleTokenFilterDescriptor, ShingleTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Shingle(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.ShingleTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.ShingleTokenFilterDescriptor, ShingleTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Shingle(string tokenFilterName, ShingleTokenFilter shingleTokenFilter) => AssignVariant(tokenFilterName, shingleTokenFilter);
	public TokenFiltersDescriptor Snowball(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.SnowballTokenFilterDescriptor, SnowballTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Snowball(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.SnowballTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.SnowballTokenFilterDescriptor, SnowballTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Snowball(string tokenFilterName, SnowballTokenFilter snowballTokenFilter) => AssignVariant(tokenFilterName, snowballTokenFilter);
	public TokenFiltersDescriptor StemmerOverride(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.StemmerOverrideTokenFilterDescriptor, StemmerOverrideTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor StemmerOverride(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.StemmerOverrideTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.StemmerOverrideTokenFilterDescriptor, StemmerOverrideTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor StemmerOverride(string tokenFilterName, StemmerOverrideTokenFilter stemmerOverrideTokenFilter) => AssignVariant(tokenFilterName, stemmerOverrideTokenFilter);
	public TokenFiltersDescriptor Stemmer(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.StemmerTokenFilterDescriptor, StemmerTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Stemmer(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.StemmerTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.StemmerTokenFilterDescriptor, StemmerTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Stemmer(string tokenFilterName, StemmerTokenFilter stemmerTokenFilter) => AssignVariant(tokenFilterName, stemmerTokenFilter);
	public TokenFiltersDescriptor Stop(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.StopTokenFilterDescriptor, StopTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Stop(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.StopTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.StopTokenFilterDescriptor, StopTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Stop(string tokenFilterName, StopTokenFilter stopTokenFilter) => AssignVariant(tokenFilterName, stopTokenFilter);
	public TokenFiltersDescriptor SynonymGraph(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.SynonymGraphTokenFilterDescriptor, SynonymGraphTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor SynonymGraph(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.SynonymGraphTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.SynonymGraphTokenFilterDescriptor, SynonymGraphTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor SynonymGraph(string tokenFilterName, SynonymGraphTokenFilter synonymGraphTokenFilter) => AssignVariant(tokenFilterName, synonymGraphTokenFilter);
	public TokenFiltersDescriptor Synonym(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.SynonymTokenFilterDescriptor, SynonymTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Synonym(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.SynonymTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.SynonymTokenFilterDescriptor, SynonymTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Synonym(string tokenFilterName, SynonymTokenFilter synonymTokenFilter) => AssignVariant(tokenFilterName, synonymTokenFilter);
	public TokenFiltersDescriptor Trim(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.TrimTokenFilterDescriptor, TrimTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Trim(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.TrimTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.TrimTokenFilterDescriptor, TrimTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Trim(string tokenFilterName, TrimTokenFilter trimTokenFilter) => AssignVariant(tokenFilterName, trimTokenFilter);
	public TokenFiltersDescriptor Truncate(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.TruncateTokenFilterDescriptor, TruncateTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Truncate(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.TruncateTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.TruncateTokenFilterDescriptor, TruncateTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Truncate(string tokenFilterName, TruncateTokenFilter truncateTokenFilter) => AssignVariant(tokenFilterName, truncateTokenFilter);
	public TokenFiltersDescriptor Unique(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.UniqueTokenFilterDescriptor, UniqueTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Unique(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.UniqueTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.UniqueTokenFilterDescriptor, UniqueTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Unique(string tokenFilterName, UniqueTokenFilter uniqueTokenFilter) => AssignVariant(tokenFilterName, uniqueTokenFilter);
	public TokenFiltersDescriptor Uppercase(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.UppercaseTokenFilterDescriptor, UppercaseTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor Uppercase(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.UppercaseTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.UppercaseTokenFilterDescriptor, UppercaseTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor Uppercase(string tokenFilterName, UppercaseTokenFilter uppercaseTokenFilter) => AssignVariant(tokenFilterName, uppercaseTokenFilter);
	public TokenFiltersDescriptor WordDelimiterGraph(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.WordDelimiterGraphTokenFilterDescriptor, WordDelimiterGraphTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor WordDelimiterGraph(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.WordDelimiterGraphTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.WordDelimiterGraphTokenFilterDescriptor, WordDelimiterGraphTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor WordDelimiterGraph(string tokenFilterName, WordDelimiterGraphTokenFilter wordDelimiterGraphTokenFilter) => AssignVariant(tokenFilterName, wordDelimiterGraphTokenFilter);
	public TokenFiltersDescriptor WordDelimiter(string tokenFilterName) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.WordDelimiterTokenFilterDescriptor, WordDelimiterTokenFilter>(tokenFilterName, null);
	public TokenFiltersDescriptor WordDelimiter(string tokenFilterName, Action<Elastic.Clients.Elasticsearch.Serverless.Analysis.WordDelimiterTokenFilterDescriptor> configure) => AssignVariant<Elastic.Clients.Elasticsearch.Serverless.Analysis.WordDelimiterTokenFilterDescriptor, WordDelimiterTokenFilter>(tokenFilterName, configure);
	public TokenFiltersDescriptor WordDelimiter(string tokenFilterName, WordDelimiterTokenFilter wordDelimiterTokenFilter) => AssignVariant(tokenFilterName, wordDelimiterTokenFilter);
}

internal sealed partial class TokenFilterInterfaceConverter : JsonConverter<ITokenFilter>
{
	public override ITokenFilter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
	{
		var copiedReader = reader;
		string? type = null;
		using var jsonDoc = JsonDocument.ParseValue(ref copiedReader);
		if (jsonDoc is not null && jsonDoc.RootElement.TryGetProperty("type", out var readType) && readType.ValueKind == JsonValueKind.String)
		{
			type = readType.ToString();
		}

		switch (type)
		{
			case "asciifolding":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.AsciiFoldingTokenFilter>(ref reader, options);
			case "common_grams":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.CommonGramsTokenFilter>(ref reader, options);
			case "condition":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.ConditionTokenFilter>(ref reader, options);
			case "delimited_payload":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.DelimitedPayloadTokenFilter>(ref reader, options);
			case "dictionary_decompounder":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.DictionaryDecompounderTokenFilter>(ref reader, options);
			case "edge_ngram":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.EdgeNGramTokenFilter>(ref reader, options);
			case "elision":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.ElisionTokenFilter>(ref reader, options);
			case "fingerprint":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.FingerprintTokenFilter>(ref reader, options);
			case "hunspell":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.HunspellTokenFilter>(ref reader, options);
			case "hyphenation_decompounder":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.HyphenationDecompounderTokenFilter>(ref reader, options);
			case "icu_collation":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuCollationTokenFilter>(ref reader, options);
			case "icu_folding":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuFoldingTokenFilter>(ref reader, options);
			case "icu_normalizer":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuNormalizationTokenFilter>(ref reader, options);
			case "icu_transform":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuTransformTokenFilter>(ref reader, options);
			case "keep_types":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeepTypesTokenFilter>(ref reader, options);
			case "keep":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeepWordsTokenFilter>(ref reader, options);
			case "keyword_marker":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.KeywordMarkerTokenFilter>(ref reader, options);
			case "kstem":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.KStemTokenFilter>(ref reader, options);
			case "kuromoji_part_of_speech":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiPartOfSpeechTokenFilter>(ref reader, options);
			case "kuromoji_readingform":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiReadingFormTokenFilter>(ref reader, options);
			case "kuromoji_stemmer":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiStemmerTokenFilter>(ref reader, options);
			case "length":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.LengthTokenFilter>(ref reader, options);
			case "limit":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.LimitTokenCountTokenFilter>(ref reader, options);
			case "lowercase":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.LowercaseTokenFilter>(ref reader, options);
			case "multiplexer":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.MultiplexerTokenFilter>(ref reader, options);
			case "ngram":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.NGramTokenFilter>(ref reader, options);
			case "nori_part_of_speech":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.NoriPartOfSpeechTokenFilter>(ref reader, options);
			case "pattern_capture":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.PatternCaptureTokenFilter>(ref reader, options);
			case "pattern_replace":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.PatternReplaceTokenFilter>(ref reader, options);
			case "phonetic":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.PhoneticTokenFilter>(ref reader, options);
			case "porter_stem":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.PorterStemTokenFilter>(ref reader, options);
			case "predicate_token_filter":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.PredicateTokenFilter>(ref reader, options);
			case "remove_duplicates":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.RemoveDuplicatesTokenFilter>(ref reader, options);
			case "reverse":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.ReverseTokenFilter>(ref reader, options);
			case "shingle":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.ShingleTokenFilter>(ref reader, options);
			case "snowball":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.SnowballTokenFilter>(ref reader, options);
			case "stemmer_override":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.StemmerOverrideTokenFilter>(ref reader, options);
			case "stemmer":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.StemmerTokenFilter>(ref reader, options);
			case "stop":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.StopTokenFilter>(ref reader, options);
			case "synonym_graph":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.SynonymGraphTokenFilter>(ref reader, options);
			case "synonym":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.SynonymTokenFilter>(ref reader, options);
			case "trim":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.TrimTokenFilter>(ref reader, options);
			case "truncate":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.TruncateTokenFilter>(ref reader, options);
			case "unique":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.UniqueTokenFilter>(ref reader, options);
			case "uppercase":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.UppercaseTokenFilter>(ref reader, options);
			case "word_delimiter_graph":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.WordDelimiterGraphTokenFilter>(ref reader, options);
			case "word_delimiter":
				return JsonSerializer.Deserialize<Elastic.Clients.Elasticsearch.Serverless.Analysis.WordDelimiterTokenFilter>(ref reader, options);
			default:
				ThrowHelper.ThrowUnknownTaggedUnionVariantJsonException(type, typeof(ITokenFilter));
				return null;
		}
	}

	public override void Write(Utf8JsonWriter writer, ITokenFilter value, JsonSerializerOptions options)
	{
		if (value is null)
		{
			writer.WriteNullValue();
			return;
		}

		switch (value.Type)
		{
			case "asciifolding":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.AsciiFoldingTokenFilter), options);
				return;
			case "common_grams":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.CommonGramsTokenFilter), options);
				return;
			case "condition":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.ConditionTokenFilter), options);
				return;
			case "delimited_payload":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.DelimitedPayloadTokenFilter), options);
				return;
			case "dictionary_decompounder":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.DictionaryDecompounderTokenFilter), options);
				return;
			case "edge_ngram":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.EdgeNGramTokenFilter), options);
				return;
			case "elision":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.ElisionTokenFilter), options);
				return;
			case "fingerprint":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.FingerprintTokenFilter), options);
				return;
			case "hunspell":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.HunspellTokenFilter), options);
				return;
			case "hyphenation_decompounder":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.HyphenationDecompounderTokenFilter), options);
				return;
			case "icu_collation":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuCollationTokenFilter), options);
				return;
			case "icu_folding":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuFoldingTokenFilter), options);
				return;
			case "icu_normalizer":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuNormalizationTokenFilter), options);
				return;
			case "icu_transform":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.IcuTransformTokenFilter), options);
				return;
			case "keep_types":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.KeepTypesTokenFilter), options);
				return;
			case "keep":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.KeepWordsTokenFilter), options);
				return;
			case "keyword_marker":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.KeywordMarkerTokenFilter), options);
				return;
			case "kstem":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.KStemTokenFilter), options);
				return;
			case "kuromoji_part_of_speech":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiPartOfSpeechTokenFilter), options);
				return;
			case "kuromoji_readingform":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiReadingFormTokenFilter), options);
				return;
			case "kuromoji_stemmer":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.KuromojiStemmerTokenFilter), options);
				return;
			case "length":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.LengthTokenFilter), options);
				return;
			case "limit":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.LimitTokenCountTokenFilter), options);
				return;
			case "lowercase":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.LowercaseTokenFilter), options);
				return;
			case "multiplexer":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.MultiplexerTokenFilter), options);
				return;
			case "ngram":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.NGramTokenFilter), options);
				return;
			case "nori_part_of_speech":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.NoriPartOfSpeechTokenFilter), options);
				return;
			case "pattern_capture":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.PatternCaptureTokenFilter), options);
				return;
			case "pattern_replace":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.PatternReplaceTokenFilter), options);
				return;
			case "phonetic":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.PhoneticTokenFilter), options);
				return;
			case "porter_stem":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.PorterStemTokenFilter), options);
				return;
			case "predicate_token_filter":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.PredicateTokenFilter), options);
				return;
			case "remove_duplicates":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.RemoveDuplicatesTokenFilter), options);
				return;
			case "reverse":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.ReverseTokenFilter), options);
				return;
			case "shingle":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.ShingleTokenFilter), options);
				return;
			case "snowball":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.SnowballTokenFilter), options);
				return;
			case "stemmer_override":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.StemmerOverrideTokenFilter), options);
				return;
			case "stemmer":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.StemmerTokenFilter), options);
				return;
			case "stop":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.StopTokenFilter), options);
				return;
			case "synonym_graph":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.SynonymGraphTokenFilter), options);
				return;
			case "synonym":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.SynonymTokenFilter), options);
				return;
			case "trim":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.TrimTokenFilter), options);
				return;
			case "truncate":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.TruncateTokenFilter), options);
				return;
			case "unique":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.UniqueTokenFilter), options);
				return;
			case "uppercase":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.UppercaseTokenFilter), options);
				return;
			case "word_delimiter_graph":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.WordDelimiterGraphTokenFilter), options);
				return;
			case "word_delimiter":
				JsonSerializer.Serialize(writer, value, typeof(Elastic.Clients.Elasticsearch.Serverless.Analysis.WordDelimiterTokenFilter), options);
				return;
			default:
				var type = value.GetType();
				JsonSerializer.Serialize(writer, value, type, options);
				return;
		}
	}
}

[JsonConverter(typeof(TokenFilterInterfaceConverter))]
public partial interface ITokenFilter
{
	public string? Type { get; }
}